import { APlugin } from '../types/common.interface';
import { Injectable, Inject, PluginInjectable } from '../decorators/inject';
import { NExcel } from '../types';
import { ModalPlugin, ChildModal } from './modal.plugin';
import { TableEvent } from '../cors/table-event';
import './settings.modal.plugin.less';
const settingBody = `
    <div class="z-excel-modal-setting-content">
        <div class="z-excel-modal-setting-header">
            <div class="z-excel-modal-setting-item z-excel-modal-setting-item-active">
                数字
            </div>
            <div class="z-excel-modal-setting-item">
                对齐
            </div>
            <div class="z-excel-modal-setting-item">
                字体
            </div>
            <div class="z-excel-modal-setting-item">
                边框
            </div>
            <div class="z-excel-modal-setting-item">
                图案
            </div>
            <div class="z-excel-modal-setting-item">
                保护
            </div>
        </div>
        <div class="z-excel-modal-setting-item-body">
        </div>
    </div>
`;

@Injectable()
@PluginInjectable('SettingModalPlugin')
export class SettingModalPlugin extends APlugin implements ChildModal{
    public containerEle: HTMLElement;
    constructor(protected modalPlugin: ModalPlugin, protected tableEvent: TableEvent) {
        super()
    }
    
    public init(): void {
        this.containerEle = document.createElement('div');
        this.containerEle.setAttribute('class', 'z-excel-modal-settings-container');
        this.containerEle.innerHTML = settingBody;
        // @ts-ignore
        this.tableEvent.id = 2;
        this.tableEvent.customEvent$.subscribe(({type, payload}) => {
            if(type === 'right-menu') {
                this.modalPlugin.show(this);
            }
        });
        // setTimeout(() => {
        //     this.modalPlugin.show(this);
        // }, 200);
        
    }
    public onSure() {
        return Promise.resolve(true);
    }
    public onClose() {
        return Promise.resolve(true);
    }
    public destroy(): void {
        
    }
}